<?php
if (!defined ('TYPO3_MODE')) die ('Access denied.');

Tx_Extbase_Utility_Extension::registerPlugin(
	$_EXTKEY,
	'Pi1',
	'Dance lesson manager'
);

t3lib_extMgm::addStaticFile($_EXTKEY, 'Configuration/TypoScript', 'Dance event manager');

//$TCA['tt_content']['types']['list']['subtypes_addlist'][$_EXTKEY . '_pi1'] = 'pi_flexform';
//t3lib_extMgm::addPiFlexFormValue($_EXTKEY . '_pi1', 'FILE:EXT:' . $_EXTKEY . '/Configuration/FlexForms/flexform_list.xml');


t3lib_extMgm::addLLrefForTCAdescr('tx_t3dance_domain_model_eventprogram','EXT:t3dance/Resources/Private/Language/locallang_csh_tx_t3dance_domain_model_eventprogram.xml');
t3lib_extMgm::allowTableOnStandardPages('tx_t3dance_domain_model_eventprogram');
$TCA['tx_t3dance_domain_model_eventprogram'] = array (
	'ctrl' => array (
		'title'             => 'LLL:EXT:t3dance/Resources/Private/Language/locallang_db.xml:tx_t3dance_domain_model_eventprogram',
		'label' 			=> 'title',
		'tstamp' 			=> 'tstamp',
		'crdate' 			=> 'crdate',
		'versioningWS' 		=> 2,
		'versioning_followPages'	=> TRUE,
		'origUid' 			=> 't3_origuid',
		'languageField' 	=> 'sys_language_uid',
		'transOrigPointerField' 	=> 'l18n_parent',
		'transOrigDiffSourceField' 	=> 'l18n_diffsource',
		'delete' 			=> 'deleted',
		'enablecolumns' 	=> array(
			'disabled' => 'hidden'
			),
		'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY) . 'Configuration/TCA/eventProgram.php',
		'iconfile' 			=> t3lib_extMgm::extRelPath($_EXTKEY) . 'Resources/Public/Icons/tx_t3dance_domain_model_eventprogram.gif'
	)
);

t3lib_extMgm::addLLrefForTCAdescr('tx_t3dance_domain_model_programaccounting','EXT:t3dance/Resources/Private/Language/locallang_csh_tx_t3dance_domain_model_programaccounting.xml');
t3lib_extMgm::allowTableOnStandardPages('tx_t3dance_domain_model_programaccounting');
$TCA['tx_t3dance_domain_model_programaccounting'] = array (
	'ctrl' => array (
		'title'             => 'LLL:EXT:t3dance/Resources/Private/Language/locallang_db.xml:tx_t3dance_domain_model_programaccounting',
		'label' 			=> 'title',
		'tstamp' 			=> 'tstamp',
		'crdate' 			=> 'crdate',
		'versioningWS' 		=> 2,
		'versioning_followPages'	=> TRUE,
		'origUid' 			=> 't3_origuid',
		'languageField' 	=> 'sys_language_uid',
		'transOrigPointerField' 	=> 'l18n_parent',
		'transOrigDiffSourceField' 	=> 'l18n_diffsource',
		'delete' 			=> 'deleted',
		'enablecolumns' 	=> array(
			'disabled' => 'hidden'
			),
		'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY) . 'Configuration/TCA/programAccounting.php',
		'iconfile' 			=> t3lib_extMgm::extRelPath($_EXTKEY) . 'Resources/Public/Icons/tx_t3dance_domain_model_programaccounting.gif'
	)
);

t3lib_extMgm::addLLrefForTCAdescr('tx_t3dance_domain_model_eventbooking','EXT:t3dance/Resources/Private/Language/locallang_csh_tx_t3dance_domain_model_eventbooking.xml');
t3lib_extMgm::allowTableOnStandardPages('tx_t3dance_domain_model_eventbooking');
$TCA['tx_t3dance_domain_model_eventbooking'] = array (
	'ctrl' => array (
		'title'             => 'LLL:EXT:t3dance/Resources/Private/Language/locallang_db.xml:tx_t3dance_domain_model_eventbooking',
		'label' 			=> 'first_name',
		'tstamp' 			=> 'tstamp',
		'crdate' 			=> 'crdate',
		'versioningWS' 		=> 2,
		'versioning_followPages'	=> TRUE,
		'origUid' 			=> 't3_origuid',
		'languageField' 	=> 'sys_language_uid',
		'transOrigPointerField' 	=> 'l18n_parent',
		'transOrigDiffSourceField' 	=> 'l18n_diffsource',
		'delete' 			=> 'deleted',
		'enablecolumns' 	=> array(
			'disabled' => 'hidden'
			),
		'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY) . 'Configuration/TCA/eventBooking.php',
		'iconfile' 			=> t3lib_extMgm::extRelPath($_EXTKEY) . 'Resources/Public/Icons/tx_t3dance_domain_model_eventbooking.gif'
	)
);


t3lib_div::loadTCA('tx_cal_event');
	$tempColumns = array(
		'tx_t3dance_eventprogram' => array(
			'exclude' => 0,
			'label'   => 'LLL:EXT:t3dance/Resources/Private/Language/locallang_db.xml:tx_t3dance_domain_model_eventbooking.tx_t3dance_eventprogram',
			'config' => array (
				'type' => 'select',	
				'foreign_table' => 'tx_t3dance_domain_model_eventprogram',	
				'foreign_table_where' => 'ORDER BY tx_t3dance_domain_model_eventprogram.crdate',	
				'size' => 1,	
				'minitems' => 0,
				'maxitems' => 1,	
				'wizards' => array(
					'_PADDING'  => 2,
					'_VERTICAL' => 1,
					'add' => array(
						'type'   => 'script',
						'title'  => 'Create new record',
						'icon'   => 'add.gif',
						'params' => array(
							'table'    => 'tx_t3dance_domain_model_eventprogram',
							'pid'      => '###CURRENT_PID###',
							'setValue' => 'prepend'
						),
						'script' => 'wizard_add.php',
					),
					'edit' => array(
						'type'                     => 'popup',
						'title'                    => 'Edit',
						'script'                   => 'wizard_edit.php',
						'popup_onlyOpenIfSelected' => 1,
						'icon'                     => 'edit2.gif',
						'JSopenParams'             => 'height=350,width=580,status=0,menubar=0,scrollbars=1',
					),
				),
			)
		),
		'tx_t3dance_price' => array(
			'exclude' => 0,		
			'label' => 'LLL:EXT:t3dance/Recources/Private/Language/locallang_db.xml:tx_t3dance_domain_model_event.tx_t3dance_price',		
			'config' => array (
				'type'     => 'input',
				'size'     => '4',
				'max'      => '4',
				'eval'     => 'int',
				'checkbox' => '0',
				'range'    => array (
					'upper' => '1000',
					'lower' => '10'
				),
				'default' => 0
			)
		)
	);
t3lib_extMgm::addTCAcolumns('tx_cal_event', $tempColumns, 1);
t3lib_extMgm::addToAllTCAtypes('tx_cal_event', 'tx_t3dance_price,tx_t3dance_eventprogram');

?>